1. Field of the Invention
The present invention relates to an image processing apparatus and an image processing method.
2. Description of Related Art
Thinning processing is known as an image processing. In thinning processing, sharpness of a character and the like is improved by decreasing pixel values at the edges of the character and the like.
Smoothing processing is also an image processing to be performed on edges. In smoothing processing, edges of an oblique line portion can be visually smoothed by making the edges be halftone by increasing or decreasing pixel values at the edges of the oblique line portion of a character and the like.
Both of thinning processing and smoothing processing are performed on edges. However, it has been difficult to perform both processing at the same time because the objects of the two processing are different. For example, though a sharp and smooth character can be obtained when thinning processing is performed on straight line portions and smoothing processing is performed on oblique line portions of a character, it is difficult to obtain such a character by a method of detecting structures of the straight line portions and the oblique line portions and switching between thinning processing and smoothing processing depending on the detected structure (see Japanese Patent Application Laid Open Publication No. H7-334672, for example). This is because there is a pixel which belongs to both the straight line portion and the oblique line portion, causing an unexpected result such as increase in pixel value due to smoothing processing though thinning, not smoothing, should have been the appropriate processing.
In response to this, the applicant developed an image processing apparatus to realize thinning processing and smoothing processing at the same time (see Japanese Patent No 4225337, for example). In this image processing apparatus, results of smoothing processing and thinning processing are stored as change amounts from the original pixel value. When a pixel value obtained by adding the stored change amounts to the original pixel value exceeds the maximum value or becomes a negative value, the excess or shortfall is adjusted by using a pixel value of an adjacent pixel which has a predetermined positional relationship with the target pixel. By adjusting the processing results of thinning processing and smoothing processing not only in the target pixel but in two pixels which are the target pixel and an adjacent pixel thereof, the two processing results can be absorbed reasonably.
When thinning processing is performed on a thin line which originally has a thin line width, the thin line may blur or disappear because both sides of the thin line are thinned. For example, in a case of a thin line which has a two-pixel width, the thin line itself disappears when the pixel values are decreased in both sides by thinning. In order to prevent such disappearance of thin line structures, the thin line structures are conventionally determined and excluded from the targets of thinning when thinning processing is performed.
However, such exclusion of thin line structures may lead to an unintended result. For example, when lossy compression is performed on image data, the original image data is not necessarily completely restored by decompression, and image quality of the character and the like may be partially degraded. For example, the outline may not be restored to be a smooth line and may be sharp and thin instead. The sharpened portion is determined to be a thin line structure when thinning processing is performed, and thinning is invalidated only at the sharpened portion. Because one character includes both not-thinned portions and thinned portions, the line widths of the character become imbalanced.
In addition, a nearly-horizontal oblique line has a structure wherein long horizontal lines are aligned in a stepwise manner, and the stepped portions temporarily have a large line width. Therefore, a phenomenon where only the stepped portions are thinned though the horizontal line is not a target of thinning processing occurs. Whereas the not-thinned horizontal lines include a lot of pixels, the thinned stepped portions include at most one or two pixels, and thus the thinned portions become isolated. When thinning processing and smoothing processing are performed at the same time on an image including such isolated thinned portions, the pixel values are decreased excessively only at the thinned portions and neither thinning nor smoothing can be realized, causing the image quality to degrade.